package com.sky.service;

import com.sky.dto.OrdersPageQueryDTO;
import com.sky.dto.OrdersPaymentDTO;
import com.sky.dto.OrdersSubmitDTO;
import com.sky.dto.SalesTop10ItemDTO;
import com.sky.entity.Orders;
import com.sky.result.PageResult;
import com.sky.vo.*;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

public interface OrderService {
    OrderSubmitVO subimt(OrdersSubmitDTO dto);

    OrderPaymentVO payment(OrdersPaymentDTO ordersPaymentDTO)throws Exception;

    void paySuccess(String outTradeNo);

    PageResult historyOrders(OrdersPageQueryDTO dto);

    OrderVO orderDetail(Long id);

    void cancel(Long id, String reason);

    void repetition(Long id);

    void reminder(Long id);

    PageResult search(OrdersPageQueryDTO dto);

    OrderStatisticsVO statistics();

    void confirm(Long id);

    void rejection(Long id, String reason);

    void delivery(Long id);

    void complete(Long id);


    List<Orders> getUnpayOrders();

    List<Orders> getByStatusAndOrderTimeBefore(Integer deliveryInProgress, LocalDateTime oneHourBefore, int page, int pageSize);

    double turnOver(LocalDateTime startTime, LocalDateTime endTime);
/**
 * 查询当天的订单总数
 * */
    int countTotalOrders(LocalDateTime startTime, LocalDateTime endTime);
    /**
     * 查询当天的有效订单
     * */
    int countValidOrders(LocalDateTime startTime, LocalDateTime endTime);
    /**
     * 销量排名
     * */
    List<SalesTop10ItemDTO> top10(LocalDate begin, LocalDate end);

    Double getTurnover(LocalDateTime start, LocalDateTime end);

    List<OrderStatusCountVO> groupCountByStatusAndCreateTime(LocalDateTime start, LocalDateTime end);
}
